package cn.system.gradledocker;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//@OpenAPIDefinition
@Controller
@SpringBootApplication
public class GradledockerApplication {
    public static final Logger log = LoggerFactory.getLogger(GradledockerApplication.class);

    public static void main(String[] args) {
        SpringApplication.run(GradledockerApplication.class, args);
    }

    @ResponseBody
    @GetMapping(value = "/hello")
    public String hello(HttpServletRequest request, HttpServletResponse response) {
        log.info(request.getRemoteAddr());
        String result = new String();
        result = "hello docker";
        log.info(result);
        return result;
    }

    @ResponseBody
    @GetMapping(value = "/hi")
    public String hi(HttpServletRequest request, HttpServletResponse response) {
        log.info(request.getRemoteAddr());
        String result = new String();
        result = "hi i'm in the docker of jenkins";
        log.info(result);
        return result;
    }

}
